﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Framework.Serialization
{
    public class JSONSerializer : ISerializationProvider
    {
        public string ToString(object obj)
        {
            return ServiceStack.Text.JsonSerializer.SerializeToString(obj, obj.GetType());
        }

        public T FromString<T>(string json)
        {
            return ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(json);
        }

        public object FromString(string json, Type objectType)
        {
            return ServiceStack.Text.JsonSerializer.DeserializeFromString(json, objectType);
        }
    }
}
